/**
 * Created by yuzhou on 16/9/23.
 */

define([
    'vue','debug', 'text!tpl/goodList.html',
    'vuex/actions/good'
], function(Vue, Debug, goodListHtml, goodAction) {

    return Vue.extend({
        template: goodListHtml,
        vuex: {
            getters: {
                all: function(store) { return store.good.all },
                loadTimestamp: function(store) { return store.good.loadTimestamp }
            },
            actions: {
                getAllGood: goodAction.getAllGood
            }
        },
        ready: function(){
            if(this.loadTimestamp == -1) {
                this.getAllGood()
            }
        }
    })
})